package uk.co.lunagroup.files;

import javax.swing.JFileChooser;

/**
 * . Class for building customized JFileChoosers
 * 
 * @author robert.kowalski
 * 
 */
public class CustomizedJFileChooser extends JFileChooser {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */

	// constructor. Using one object to store all configruation parameters
	public CustomizedJFileChooser(final ParametersForJFileChooser configuration) {
	}

	/**
	 * . This method builds customized chooser with parameters passed in
	 * inputConfiguration (ConfigureJFileChooser class)
	 * 
	 * @param inputConfiguration
	 *            configuration
	 * @return return JFileChooser which is configured
	 */
	public static JFileChooser buildJFileChooser(
			final ParametersForJFileChooser inputConfiguration) {
		JFileChooser chooser = new JFileChooser();

		chooser.setCurrentDirectory(new java.io.File(inputConfiguration
				.getPathName()));
		chooser.setDialogTitle(inputConfiguration.getDialogTitle());
		chooser.setFileSelectionMode(inputConfiguration.getSelectionMode());
		chooser.setFileFilter(inputConfiguration.getFilter());

		return chooser;
	}
}
